#!/usr/bin/perl

use SOAP::Lite;
use Data::Dumper;

use warnings;
use strict;

my $service = SOAP::Lite->proxy('http://localhost:8080/exist/services/Query'); 

my $session_id = $service->connect('dario','')->result; 
my $soap_data = SOAP::Data->new( name => 'sessionId', value => $session_id )->type('xsd:string');
my $document = SOAP::Data->new( name => 'path', value => '/db/aap' )->type('xsd:string'); 

my $result = $service->listCollection($soap_data, $document); 

if ($result->fault) {
  die $result->faultstring, "\n";
} else {
  print Dumper $result->result->{collections}->{elements};
}
